package cn.rainless.zxing.demo;

import com.google.zxing.WriterException;

import javax.imageio.ImageIO;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;

public class DeviceQrApp {

  public static void main(String[] args) {
    try {
      DeviceInfo device = new DeviceInfo();
      device.setNo("1142000105021020000001");
      device.setModel("P770");
      device.setSn("1234567890");
      device.setManager("杨斯可");
      device.setManagerPhone("18627114100");
      device.setUsage("一体化平台数据库");
      device.setPosition("三楼机房-B01-24");
      device.setIp("192.168.101.100");
      device.setCheckDate("2016年10月14日");
      device.setQrCode("http://www.rainless.cn/public/assets/" + device.getNo());
      BufferedImage image = DeviceQrCreator.createPng(device);
      ImageIO.write(image, "png", new File("D:/qr" + device.getNo() + ".png"));
    } catch (WriterException e) {
      e.printStackTrace();
    } catch (IOException e) {
      e.printStackTrace();
    }
  }

}
